package Demo2;

public class Test2 {
    public static void func(Animal animal){
        animal.eat();
    }

    public static void main(String[] args) {
        Dog dog=new Dog("小米渣",2);
        func(dog);
        System.out.println("==========");
        Bird bird=new Bird("小鸟",5);
        func(bird); //多态
    }
    public static void main01(String[] args) {
        Animal animal=new Dog("小米渣",2);
        animal.eat();   //动态绑定
    }
}
